home *** CD-ROM | disk | FTP | other *** search
/ AGA Toolkit '97 / The AGA Toolkit '97.iso / miscellaneous / science / maths / calc / help / config < prev    next >
Encoding:
Text File  |  1996-09-07  |  5.3 KB  |  115 lines

  1. Configuration parameters
  2.  
  3.     Configuration parameters affect how the calculator performs certain
  4.     operations, and affects all future calculations.  These parameters
  5.     affect the accuracy of calculations, the displayed format of results,
  6.     and which algorithms are used for calculations.  The parameters are
  7.     read or set using the "config" built-in function.  The following
  8.     parameters can be specified:
  9.  
  10.         "trace"        turns tracing on or off (for debugging).
  11.         "display"    sets number of digits in prints.
  12.         "epsilon"    sets error value for transcendentals.
  13.         "maxprint"    sets maximum number of elements printed.
  14.         "mode"        sets printout mode.
  15.         "mul2"        sets size for alternative multiply.
  16.         "sq2"        sets size for alternative squaring.
  17.         "pow2"        sets size for alternate powering.
  18.         "redc2"        sets size for alternate REDC.
  19.         "tilde"        enable/disable printing of the roundoff '~'
  20.         "tab"        enable/disable printing of leading tabs
  21.  
  22.     The use of the trace flag is for debugging, and its meaning may
  23.     change in the future.  A value of 1 causes the calculator to print
  24.     its internal opcodes as it executes functions.  A value of zero
  25.     disables tracing again.
  26.  
  27.     Display specifies how many digits after the decimal point should
  28.     be printed when printing real or exponential numbers.  The initial
  29.     display value is 20.  This parameter does not affect the accuracy
  30.     of a calculation, since it only has meaning when printing results.
  31.  
  32.     Epsilon specifies the required precision of calculations by
  33.     setting the maximum allowed error for transcendental functions.
  34.     The error is an absolute error value for many functions, but
  35.     for some functions it is a relative error.  The initial value
  36.     is 1e-20.  Functions which require an epsilon value accept an
  37.     optional argument which overrides this default epsilon value for
  38.     that single call.  The built-in function "epsilon" also can be
  39.     used to read or set this value, and is provided for ease of use.
  40.  
  41.     Mode specifies how numbers should be printed.  Mode is a string
  42.     value indicating the printout method.  The initial mode is "real".
  43.     Possible modes are:
  44.  
  45.         "frac"        decimal fractions
  46.         "int"        decimal integer
  47.         "real"        decimal floating point
  48.         "exp"        decimal exponential
  49.         "hex"        hex fractions
  50.         "oct"        octal fractions
  51.         "bin"        binary fractions
  52.  
  53.     Maxprint specifies the maximum number of elements to be displayed
  54.     when a matrix or list is printed.  The initial value is 16 elements.
  55.  
  56.     Mul2 and sq2 specify the sizes of numbers at which calc switches
  57.     from its first to its second algorithm for multiplying and squaring.
  58.     The first algorithm is the usual method of cross multiplying, which
  59.     runs in a time of O(N^2).  The second method is a recursive and
  60.     complicated method which runs in a time of O(N^1.585).  The argument
  61.     for these parameters is the number of binary words at which the
  62.     second algorithm begins to be used.  The minimum value is 2, and
  63.     the maximum value is very large.  If 2 is used, then the recursive
  64.     algorithm is used all the way down to single digits, which becomes
  65.     slow since the recursion overhead is high.  If a number such as
  66.     1000000 is used, then the recursive algorithm is never used, causing
  67.     calculations for large numbers to slow down.  For a typical example
  68.     on a 386, the two algorithms are about equal in speed for a value
  69.     of 20, which is about 100 decimal digits.  A value of zero resets
  70.     the parameter back to its default value.  Usually there is no need
  71.     to change these parameters.
  72.  
  73.     Pow2 specifies the sizes of numbers at which calc switches from
  74.     its first to its second algorithm for calculating powers modulo
  75.     another number.  The first algorithm for calculating modular powers
  76.     is by repeated squaring and multiplying and dividing by the modulus.
  77.     The second method uses the REDC algorithm given by Peter Montgomery
  78.     which avoids divisions.  The argument for pow2 is the size of the
  79.     modulus at which the second algorithm begins to be used.
  80.  
  81.     Redc2 specifies the sizes of numbers at which calc switches from
  82.     its first to its second algorithm when using the REDC algorithm.
  83.     The first algorithm performs a multiply and a modular reduction
  84.     together in one loop which runs in O(N^2).  The second algorithm
  85.     does the REDC calculation using three multiplies, and runs in
  86.     O(N^1.585).  The argument for redc2 is the size of the modulus at
  87.     which the second algorithm begins to be used.
  88.  
  89.     Tilde controls the printing of a leading tilde ('~') in front
  90.     of rounded values.  By default for integer, real, or exponential 
  91.     formats, a leading '~' indicates that the number was truncated 
  92.     to the number of decimal places specified by the default precision.
  93.     The second config arg may be any truth value.
  94.  
  95.     Tab controls the printing of a tab before values.  By default,
  96.     printed expressions proceeded by a tab.  This config option
  97.     does not control the format of functions such as print or printf.
  98.     The second config arg may be any truth value.
  99.  
  100.     The following are synonyms for true:
  101.  
  102.         "on"   "yes"   "y"   "true"   "t"   "1"   any non-zero number
  103.  
  104.     The following are synonyms for false:
  105.  
  106.         "off"  "no"    "n"   "false"  "f"   "0"   the number zero (0)
  107.  
  108.     Examples of setting some parameters are:
  109.  
  110.         config("mode", "exp");        exponential output
  111.         config("display", 50);        50 digits of output
  112.         epsilon(epsilon() / 8);        3 bits more accuracy
  113.         config("tilde", 0)        disable roundoff tilde printing
  114.         config("tab", "off")        disable leading tab printing
  115.